import warehouseApi from "@/api/declaration/erp/warehouseApi"
import httpRequest from "@/config/axios/httpRequest"
import { WarehouseModel } from "@/models/erp/WarehouseModel"




// ERP 仓库 API
export const WarehouseApi = {
  // 查询仓库分页
  getWarehousePage: async (params: any) => {
    return await httpRequest.get(warehouseApi.GetWarehousePage, { params })
  },

  // 查询仓库精简列表
  getWarehouseSimpleList: async () => {
    return await  httpRequest.get<WarehouseModel[]>(warehouseApi.GetWarehouseSimpleList)
  },

  // 查询仓库详情
  getWarehouse: async (id: number) => {
    return await httpRequest.get(warehouseApi.GetWarehouse, { params: { id } })
  },

  // 新增仓库
  createWarehouse: async (data: WarehouseModel) => {
    return await httpRequest.post(warehouseApi.CreateWarehouse, data)
  },

  // 修改仓库
  updateWarehouse: async (data: WarehouseModel) => {
    return await httpRequest.put(warehouseApi.UpdateWarehouse, data)
  },

  // 修改仓库默认状态
  updateWarehouseDefaultStatus: async (id: number, defaultStatus: boolean) => {
    return await httpRequest.put(warehouseApi.UpdateWarehouseDefaultStatus, { id, defaultStatus })
  },

  // 删除仓库
  deleteWarehouse: async (id: number) => {
    return await httpRequest.delete(warehouseApi.DeleteWarehouse, { params: { id } })
  },

  // 导出仓库 Excel
  exportWarehouse: async (params) => {
    return await httpRequest.download(warehouseApi.ExportWarehouse, params)
  }
}
